home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / OLE2BOOK.ZIP / CHAP02.ZIP / CHAP02 / SCHMOO / SCHMOO.H < prev    next >
C/C++ Source or Header  |  1993-04-13  |  4KB  |  164 lines

  1. /*
  2.  * SCHMOO.H
  3.  *
  4.  * Single include file that pulls in everything needed for other source
  5.  * files in the Schmoo application.
  6.  *
  7.  * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Software Design Engineer
  10.  * Microsoft Systems Developer Relations
  11.  *
  12.  * Internet  :  kraigb@microsoft.com
  13.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  14.  */
  15.  
  16.  
  17. #ifndef _SCHMOO_H_
  18. #define _SCHMOO_H_
  19.  
  20. #include <windows.h>
  21. #include <memory.h>
  22.  
  23. //These include files reference DLLs that don't have extern "C" already
  24. extern "C"
  25.     {
  26.     #include <commdlg.h>
  27.     }
  28.  
  29. #include <classlib.h>
  30.  
  31. #include <debug.h>
  32. #include <win1632.h>
  33. #include "resource.h"
  34.  
  35.  
  36. //Get the editor window information.
  37. #include "polyline.h"
  38.  
  39.  
  40.  
  41. //SCHMOO.CPP:  Frame object that creates a main window
  42.  
  43. class __far CSchmooFrame : public CFrame
  44.     {
  45.     private:
  46.         HBITMAP         m_hBmpLines[5];     //Menu item bitmaps
  47.  
  48.     protected:
  49.         //Overridable for creating a CClient for this frame
  50.         virtual LPCClient CreateCClient(void);
  51.  
  52.         virtual BOOL      FRegisterAllClasses(void);
  53.         virtual BOOL      FPreShowInit(void);
  54.         virtual UINT      CreateGizmos(void);
  55.  
  56.         virtual LRESULT   OnCommand(HWND, WPARAM, LPARAM);
  57.         virtual void      OnDocumentDataChange(LPCDocument);
  58.         virtual void      OnDocumentActivate(LPCDocument);
  59.  
  60.         //New for this class
  61.         virtual void      CreateLineMenu(void);
  62.  
  63.     public:
  64.         CSchmooFrame(HINSTANCE, HINSTANCE, LPSTR, int);
  65.         virtual ~CSchmooFrame(void);
  66.  
  67.         //Overrides
  68.         virtual void      UpdateMenus(HMENU, UINT);
  69.         virtual void      UpdateGizmos(void);
  70.  
  71.         //New for this class
  72.         virtual void      CheckLineSelection(UINT);
  73.     };
  74.  
  75.  
  76. typedef CSchmooFrame FAR * LPCSchmooFrame;
  77.  
  78.  
  79.  
  80.  
  81.  
  82. //CLIENT.CPP
  83.  
  84. /*
  85.  * The only reason we have a derived class here is to override
  86.  * CreateCDocument so we can create our own type as well as
  87.  * overriding NewDocument to perform one other piece of work once the
  88.  * document's been created.
  89.  */
  90.  
  91. class __far CSchmooClient : public CClient
  92.     {
  93.     protected:
  94.         //Overridable for creating a new CDocument
  95.         virtual LPCDocument CreateCDocument();
  96.  
  97.     public:
  98.         CSchmooClient(HINSTANCE);
  99.         virtual ~CSchmooClient(void);
  100.  
  101.         virtual LPCDocument NewDocument(BOOL, LPCDocumentAdviseSink);
  102.     };
  103.  
  104.  
  105. typedef CSchmooClient FAR * LPCSchmooClient;
  106.  
  107.  
  108.  
  109.  
  110. //DOCUMENT.CPP
  111.  
  112. //Constant ID for the window polyline that lives in a document window
  113. #define ID_POLYLINE         10
  114.  
  115.  
  116. class __far CSchmooDoc : public CDocument
  117.     {
  118.     friend class CPolylineAdviseSink;
  119.  
  120.     protected:
  121.         UINT            m_uPrevSize;        //Last WM_SIZE wParam
  122.         LONG            m_lVer;             //Loaded Polyline version
  123.  
  124.         LPCPolyline             m_pPL;      //Polyline Editor window in us.
  125.         LPCPolylineAdviseSink   m_pPLAdv;   //Advises from Polyline
  126.  
  127.     protected:
  128.         virtual BOOL    FMessageHook(HWND, UINT, WPARAM, LPARAM, LRESULT FAR *);
  129.  
  130.     public:
  131.         CSchmooDoc(HINSTANCE);
  132.         virtual ~CSchmooDoc(void);
  133.  
  134.         virtual BOOL     FInit(LPDOCUMENTINIT);
  135.  
  136.         virtual void     Clear();
  137.  
  138.         virtual UINT     ULoad(BOOL, LPSTR);
  139.         virtual UINT     USave(UINT, LPSTR);
  140.  
  141.         virtual void     Undo(void);
  142.         virtual BOOL     FClip(HWND, BOOL);
  143.         virtual HGLOBAL  RenderFormat(UINT);
  144.         virtual BOOL     FQueryPaste(void);
  145.         virtual BOOL     FPaste(HWND);
  146.  
  147.         virtual COLORREF ColorSet(UINT, COLORREF);
  148.         virtual COLORREF ColorGet(UINT);
  149.  
  150.         virtual UINT     LineStyleSet(UINT);
  151.         virtual UINT     LineStyleGet();
  152.     };
  153.  
  154. typedef CSchmooDoc FAR * LPCSchmooDoc;
  155.  
  156.  
  157. //These color indices wrap the polyline definitions
  158. #define DOCCOLOR_BACKGROUND             POLYLINECOLOR_BACKGROUND
  159. #define DOCCOLOR_LINE                   POLYLINECOLOR_LINE
  160.  
  161.  
  162.  
  163. #endif //_SCHMOO_H_
  164.